package org.example.design.代理.动态;

import java.lang.reflect.Proxy;

/**
 * @Auther:Liu
 * @Testname:App
 * @Date:2025/8/15 16:13
 */
public class App {
    public static void a() {
        ClassLoader loader = EmpMapper.class.getClassLoader();
        Class[] classes = {EmpMapper.class};
        DynamicProxyHandler handler = new DynamicProxyHandler();
        EmpMapper o = (EmpMapper) Proxy.newProxyInstance(loader, classes, handler);
        String s = o.findById(1);
        System.out.println(s);
    }

    public static void b() {
        Boss boss = new Boss();
        CGLibProxyHandler cgLibProxyHandler = new CGLibProxyHandler();
        cgLibProxyHandler.CGLibProxyHandler(boss);
        boss.eat();
    }

    public static void main(String[] args) {
        Boss boss = new Boss();
        CGLibProxyHandler cgLibProxyHandler = new CGLibProxyHandler();
        cgLibProxyHandler.CGLibProxyHandler(boss);
        boss.eat();
    }
}
